/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Home-pc
 * Date: 2023-09-17
 * Time: 16:59
 */
//基于内部类，继承Thread
public class Demo3 {
    public static void main(String[] args) throws InterruptedException {
     Thread t= new Thread(){
         @Override
         public void run() {
             while(true){
             try {
                 Thread.sleep(1000);
             } catch (InterruptedException e) {
                 e.printStackTrace();
             }

                    System.out.println("这里是线程1");
             }
         }
     };
     t.start();
     while(true){
         Thread.sleep(1000);
         System.out.println("这里是主线程");
     }
    }
}
